import { createRouter, createWebHistory } from 'vue-router'
import HomeView from '../views/HomeView.vue'

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    redirect:'/index',
    children:[
      {path: '/myOrder', component: () => import('../views/personal/MyOrderView.vue')},
      {path: '/orderDetails', component: () => import('../views/personal/OrderDetailsView.vue')},
      {path: '/personalCenter', component: () => import('../views/personal/PersonalCenterView.vue')},
      {path: '/personalInfo', component: () => import('../views/personal/PersonalInfoView.vue')},
      {path: '/product', component: () => import('../views/product/ProductDetailsView.vue')},
      {path: '/search', component: () => import('../views/product/SearchView.vue')},
      {path: '/payment', component: () => import('../views/shopping/PaymentView.vue')},
      {path: '/cart', component: () => import('../views/shopping/ShoppingCartView.vue')},
      {path: '/submitOrder', component: () => import('../views/shopping/SubmitOrderView.vue')},
      {path: '/login', component: () => import('../views/user/UserLoginView.vue')},
      {path: '/reg', component: () => import('../views/user/UserRegView.vue')},
      {path: '/index', component: () => import('../views/index.vue')},
    ]
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
